﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="Calligraphy.BasicPage1"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Calligraphy"
    xmlns:common="using:Calligraphy.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>

        <CollectionViewSource x:Name="resultsViewSource" />
    </Page.Resources>


    

        <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid Style="{StaticResource LayoutRootStyle}" DataContext="{Binding Source={StaticResource resultsViewSource}}">
        
        

        <!-- Back button and page title -->

            
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            
            <ScrollViewer Grid.RowSpan="2" Name="ImageScroll"  HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"  >
            <Image Grid.RowSpan="2"  Name="Ima_fullScrean" Source="{Binding Photo}" Stretch="Uniform" Visibility="Visible"/>
            </ScrollViewer>
            <!--<Image  Name="Ima_actually" Source="{Binding Photo}" Stretch="Uniform" Visibility="Collapsed"/>-->
            <!--<TextBlock x:Name="txb_text" FontSize="15" Width="200" TextWrapping="Wrap"  Text="{Binding Text}" 
                   Style="{StaticResource PageHeaderTextStyle}" VerticalAlignment="Stretch"  Margin="1055,-3,1,10"
                   Visibility="Collapsed"/>-->
            <Canvas Width="250" Height="450"  Grid.RowSpan="2"  Name="myCanvasStretch"  Visibility="Collapsed" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="920,50,0,0"
                    ManipulationStarted="start"
                    ManipulationDelta="delta"
                    ManipulationCompleted="complete"
                    ManipulationInertiaStarting="inertiastart"
                    ManipulationMode="All">
                <Canvas.RenderTransform>
                    <TranslateTransform x:Name="translatetransform"/>
                </Canvas.RenderTransform>
                <TextBlock FontSize="20" Text="{Binding Text}" Canvas.Left="0" Canvas.Top="0" Name="changes" 
                               Width="{Binding ElementName=myCanvasStretch,Path=Width}"  
                               Height="{Binding ElementName=myCanvasStretch,Path=Height}" 
                               TextWrapping="Wrap" Margin="0,10,0,0" HorizontalAlignment="Center" VerticalAlignment="Center">
                </TextBlock>
            
                <Thumb Name="myThumb1" Canvas.Left="{Binding ElementName=myCanvasStretch,Path=Width}"
                       Canvas.Top="{Binding ElementName=myCanvasStretch,Path=Height}" Background="Blue" 
                       Width="20"  Height="20" DragDelta="onDragDelta_1" >
                    <Thumb.RenderTransform>
                        <TranslateTransform x:Name="translatetransform1"/>
                    </Thumb.RenderTransform>
                </Thumb>
                <Thumb Name="myThumb2" Canvas.Left="-20" Canvas.Top="-20" Background="Blue"
                       Width="20" Height="20" DragDelta="onDragDelta_2"/>
                <Thumb Name="myThumb3" Canvas.Left="-20" Canvas.Top="{Binding ElementName=myCanvasStretch,Path=Height}" Background="Blue"
                       Width="20" Height="20" DragDelta="onDragDelta_3"/>
                <Thumb Name="myThumb4" Canvas.Left="{Binding ElementName=myCanvasStretch,Path=Width}" Background="Blue"
                       Canvas.Top="-20" Width="20" Height="20" DragDelta="onDragDelta_4"/>
            </Canvas>
        </Grid>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="90"/>
                
            </Grid.RowDefinitions>
            <AppBar Grid.Row="1" >
                <Grid>
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" >
                        <Button x:Name="btn1" Style="{StaticResource MessageAppBarButtonStyle}" AutomationProperties.Name="译文" Click="ShowMessage_Click"/>
                        <!--<Button x:Name="btn_fullScrean" Style="{StaticResource FullScreenAppBarButtonStyle}" AutomationProperties.Name="全屏" Click="btn_fullScrean_Click_1"/>-->
                        <!--<Button x:Name="btn2" Style="{StaticResource BackToWindowAppBarButtonStyle}" AutomationProperties.Name="原图" Click="BackToWindow_Click"/>-->
                    </StackPanel>
                </Grid>
            </AppBar>
        </Grid>

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="140"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            
            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
        </Grid>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="140"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="140"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <!--<TextBlock x:Name="pageTitle" Grid.Column="1" Style="{StaticResource PageHeaderTextStyle}" GotFocus="pageTitle_GotFocus_1"/>-->
            <Button Name="btn_pageTitle" Height="60"  Grid.Column="1" BorderThickness="0" FontSize="36" FontFamily="Microsoft YaHei UI" Margin="0,56,0,24"  Click="btn_pageTitle_Click_1"/>

        </Grid>

        <VisualStateManager.VisualStateGroups>

            <!-- Visual states reflect the application's view state -->
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>

                <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <!-- The back button and title have different styles when snapped -->
                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</common:LayoutAwarePage>
